/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.dao;

import java.lang.reflect.ParameterizedType;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;

/**
 *
 * @author carlos
 */
public class DaoFactory {

  @Produces
  public GenericDAO create(InjectionPoint injectionPoint) {
    ParameterizedType type = (ParameterizedType) injectionPoint.getType();
    Class classe = (Class) type.getActualTypeArguments()[0];
    return new GenericDAO(classe);
  }
}
